
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>新零售商城后台首页</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link href="/layui/css/layui.css"  rel="stylesheet">
    <link href="/style/admin.css"  rel="stylesheet">
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
							<div class="layui-input-inline" style="width:100px;">
                                <select name="orderStatus" id="orderStatus"  lay-verify="required" lay-filter="select1">
                                    <option selected="selected" value="0">省份</option>
                                    <option value="701">贵州省</option>
                                    <option value="702">四川省</option>
                                    <option value="703">湖南省</option>
									<option value="703">广东省</option>
                                </select>
                            </div>
				<div class="layui-inline">
                    <label class="layui-form-label">用户编号</label>
                    <div class="layui-input-block">
                        <input type="text" name="userName" id="userName" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
				<div class="layui-inline">
                    <label class="layui-form-label">用户姓名</label>
                    <div class="layui-input-block">
                        <input type="text" name="userName" id="userName" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
				<div class="layui-inline">
                    <label class="layui-form-label">手机号码</label>
                    <div class="layui-input-block">
                        <input type="text" name="userName" id="userName" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
				<div class="layui-inline">
                    <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-search" onclick="SelectData()">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                    </button>
                </div>
				<div class="layui-inline" style="float:right">
					<button class="layui-btn layuiadmin-btn-admin" data-type="add" onclick="WinOpenAdd();">添加</button>
                </div>
            </div>
        </div>

        <div class="layui-card-body">

            <table class="layui-hide" id="test"></table>
            <script type="text/html" id="barDemo">
                <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" onclick="WinOpenDel({{d.goodsId}})">删除</a>
            </script>

        </div>
    </div>
</div>

<script src="/layui/layui.js"></script>
<script src="/layui/jquery.min.js"></script>
<style>
    .layui-body{overflow-y: scroll;}	
	.laytable-cell-1-orderId{width:50px;}
</style>
<script>
    var table;
    layui.use('table', function(){
        table = layui.table
            ,form = layui.form;

        table.render({
            elem: '#test'
            ,url:'/data/user/add.js'
			,cellMinWidth:80
            ,cols: [[
                {type:'numbers'}
                ,{type: 'checkbox'}
                ,{field:'userId', title:'用户ID'}
				,{field:'name', title: '姓名'}
				,{field:'phone', title: '手机号'}
				,{field:'provinceName', title:'省'}
				,{field:'cityName', title:'市'}
				,{field:'areaName', title: '区'}
				,{field:'detailAddr', title: '详细地址'}
                ,{field:'goods',title:'编辑', templet: '#barDemo', unresize: true}
            ]]
            ,page: true
            ,id: 'testReload'
        });

        //监听表格复选框选择
        table.on('checkbox(demo)', function(obj){
            console.log(obj)
        });


    });


    function createTime(v){
        return new Date(parseInt(v)).toLocaleString()
    }
    /**重写toLocaleString方法*/
    Date.prototype.toLocaleString = function() {
        var y = this.getFullYear();
        var m = this.getMonth()+1;
        m = m<10?'0'+m:m;
        var d = this.getDate();
        d = d<10?("0"+d):d;
        var h = this.getHours();
        h = h<10?("0"+h):h;
        var M = this.getMinutes();
        M = M<10?("0"+M):M;
        var S=this.getSeconds();
        S=S<10?("0"+S):S;
        return y+"-"+m+"-"+d+" "+h+":"+M+":"+S;}

	/*删除*/
	function WinOpenDel(goodsId){
		window.parent.WinOpenEdit(this,"/user/add/del.html?goodsId="+goodsId,"删除",340,300,1);
	}
</script>
</body>
</html>

